import { CoolController, BaseController, CoolUrlTag, TagTypes } from '@cool-midway/core';
import { SchoolEntity } from '../../entity/school';
import { Context } from '@midwayjs/koa';

/**
 * 学校
 */
@CoolUrlTag({ key: TagTypes.IGNORE_TOKEN, value: ['list'] })
@CoolController({
    api: ['add', 'delete', 'update', 'info', 'list', 'page'],
    entity: SchoolEntity,
    listQueryOp: {
        // 增加其他条件
        where: async (ctx: Context) => {
            return [
                // 状态正常
                ['a.status = :status', { status: 1 }],
            ]
        },
        addOrderBy: {
            id: 'asc'
        }
    }
})
export class SchoolController extends BaseController { }
